package com.zzxx.wechat;


import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

public class MybatisGenerator {

    public static void main(String[] args) {

        String projectPath = System.getProperty("user.dir");
        System.out.println(projectPath);

        FastAutoGenerator.create("jdbc:mysql://8.152.154.163:3306/flask_arcteryx?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8", "root", "39057766aa9049b3")
                .globalConfig(builder -> {
                    builder//.author("紫金") // 设置作者
                            //.enableSwagger() // 开启 swagger 模式
                            .outputDir(projectPath + "/src/main/java"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.zzxx.wechat") // 设置父包名
                            // .moduleName("") // 设置父包模块名  需要你就设置
                            .pathInfo(Collections.singletonMap(OutputFile.xml, projectPath + "/src/main/resources/mapper"))   //// 设置mapperXml生成路径
                            .service("dao")
                            .serviceImpl("dao")
                    ;
                })
                .strategyConfig(builder -> {
                    builder.addInclude("arcteryx_link");// 设置需要生成的表名
                    builder.addTablePrefix("t_", "c_"); // 设置过滤表前缀  卡尼的表是否存在前缀
                    builder.entityBuilder() //;
                            .enableFileOverride();//
                    builder.serviceBuilder()//.formatServiceFileName("%sDao")
                            .formatServiceImplFileName("%sDao");

                })
                .execute();
    }


}
